export default {
  watch: {
    columnData(newVal) {
      newVal.map((item) => {
        if (item.hasOwnProperty('enabled')) {
          return item.enabled = Boolean(item.enabled)
        }
        if (item.hasOwnProperty('enable')) {
          return item.enable = Boolean(item.enable)
        }
        if(item.hasOwnProperty('publishStatus')){
          return item.publishStatus = Boolean(item.publishStatus)
        }
      })
      return newVal
    },
    form:{
      handler(newVal) {
        if (newVal.hasOwnProperty('enable')) {
          newVal.enable = Boolean(newVal.enable)
        }
        if (newVal.hasOwnProperty('publishStatus')) {
          newVal.publishStatus = Boolean(newVal.publishStatus)
        }
        return newVal
      },
      deep:true
    }
  },
  methods: {
    handleEnable(formData) {
      let form = Object.assign({}, formData)
      if (form.hasOwnProperty('enable')) {
        form.enable = Number(form.enable)
      }
      if (form.hasOwnProperty('publishStatus')) {
        form.publishStatus = Number(form.publishStatus)
      }
      return form
    }
  }
}
